home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QRZ! Ham Radio 3
/
QRZ Ham Radio Callsign Database - Volume 3.iso
/
world
/
mac
/
contest
/
dxmapsea.hqx
/
DX Map 1.1.1
/
coords.p
< prev
next >
Wrap
Text File
|
1992-09-05
|
1KB
|
50 lines
unit coords;
interface
uses
HyperXCmd;
procedure main (paramPtr: XCmdPtr);
implementation
procedure main;
const
pi = 3.141592654;
var
call, country: string;
tstr, str: Str255;
c, d, e, clat, clon, lat, lon, slat, sclat, cclat: real;
x: extended;
begin
ZeroToPas(paramPtr, paramPtr^.params[1]^, str);
x := StrToExt(paramPtr, str);
clat := x * pi / 180;
ZeroToPas(paramPtr, paramPtr^.params[2]^, str);
x := StrToExt(paramPtr, str);
clon := x * pi / 180;
ZeroToPas(paramPtr, paramPtr^.params[3]^, str);
x := StrToExt(paramPtr, str);
lat := x * pi / 180;
ZeroToPas(paramPtr, paramPtr^.params[4]^, str);
x := StrToExt(paramPtr, str);
lon := x * pi / 180;
slat := sin(lat);
sclat := sin(clat);
cclat := cos(clat);
e := sclat * slat + cclat * cos(lat) * cos(lon - clon);
d := -arctan(e / sqrt(1 - e * e)) + pi / 2;
c := (slat - sclat * e) / (cclat * sin(d));
c := -arctan(c / sqrt(1 - c * c)) + pi / 2;
if sin(lon - clon) < 0 then
c := 2 * pi - c;
x := d * 3955.76;
ExtToStr(paramPtr, x, str);
x := d * 6366.19;
ExtToStr(paramPtr, x, tstr);
str := concat(str, ', ', tstr);
x := c * 180 / pi;
ExtToStr(paramPtr, x, tstr);
str := concat(str, ', ', tstr);
paramPtr^.returnValue := PasToZero(paramPtr, str);
end; { main }
end. { implementation }